package cn.itsource.basic.util;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import java.util.HashMap;

@Component //交给spring管理
public class SendMessageService {

    public void sendPhoneMessage(String phone,String code) {
        HashMap<String, Object> map = new HashMap<>();

        map.put("Uid", "lkqq");
        map.put("key", "09F3FFBEDDBFB064A85E93295F256A5C");
        map.put("smsMob",phone);
        map.put("smsText","【宠物乐园验证码】"+code+"，有效时间5分钟，打死也不要告诉别人");


        HttpUtil.get("http://utf8.api.smschinese.cn/",map);
    }

    public static void main(String[] args) {
        System.out.println(RandomUtil.randomNumbers(4));
        System.out.println(RandomUtil.randomNumbers(4));
        System.out.println(RandomUtil.randomNumbers(4));
        System.out.println(RandomUtil.randomNumbers(4));
        System.out.println(RandomUtil.randomNumbers(4));
    }

}
  